<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<p>each循环list的使用</p>
<br/>
<table border="0" cellpadding="20" cellspacing="0">
  <thead style="text-align: center">
  <tr>
    <td >id</td>
    <td>姓名</td>
    <td>年龄</td>
  </tr>
  </thead>
  <tbody style="text-align: center">
    <tr th:each="student:${eachStudent}">
      <td th:text="${student.id}">id</td>
      <td th:text="${student.name}">姓名</td>
      <td th:text="${student.age}">年龄</td>
    </tr>
  </tbody>
</table>

<br/><br/>
<p>循环each Map</p>
<p th:each="m:${stumap}">
  <span th:text="${m.key}"></span>
  <span th:text="${m.value}"></span>
</p>

<br/><br/>
<p>循环each list-Map</p>
<div>
  <ul th:each="lm:${listMap}">
    <li th:each="entry:${lm}" th:text="${entry.key}"></li>
    <li th:each="entry:${lm}" th:text="${entry.value}"></li>
  </ul>
</div>

<br/><br/>
<p>循环each 数组</p>
<ul>
  <li th:each="name:${names}" th:text="${name}"></li>
</ul>

<br/><br/>
<p>循环each select</p>
<div>
  <select>
    <option th:each="city:${citys}" th:value="${city.key}" th:text="${city.value}" th:selected="${city.value} eq ${selected}"></option>
  </select>
</div>

<br/><br/>
<p>循环each 状态变量</p>
<table border="0" cellpadding="20" cellspacing="0">
  <thead style="text-align: center">
  <tr>
    <td>信息</td>
    <td >id</td>
    <td>姓名</td>
    <td>年龄</td>
    <td>奇偶</td>
  </tr>
  </thead>
  <tbody style="text-align: center">
  <tr th:each="student,loopStatus:${eachStudent}">
    <td th:text="${loopStatus.count}+'/'+${loopStatus.size}"></td>
    <td th:text="${student.id}">id</td>
    <td th:text="${student.name}">姓名</td>
    <td th:text="${student.age}">年龄</td>
    <td th:text="${loopStatus.odd}?'奇数行':'偶数行'"></td>
  </tr>
  </tbody>
</table>
</body>
</html>